home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Games of Daze
/
Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso
/
x2ftp
/
msdos
/
source
/
siv
/
s3.asm
< prev
next >
Wrap
Assembly Source File
|
1994-04-25
|
13KB
|
413 lines
; First Attempt at scrolling...
────────────────────────────────────────────────────────────────────────────────
.model small
.286
.stack 1024
.data
jumps
; 1 2 3
;1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 6
map1 db 0,0,0,1,1,1,0,1,0,1,0,0,0,1,1,0,1,0,0,1,1,0,0,0,0,0,0,0,1,0,1,1,0,0,1,0,1,0 ;0
db 0,0,0,1,1,1,0,1,0,1,0,0,0,1,1,0,1,0,0,1,1,0,0,0,0,0,0,0,1,0,1,1,0,0,1,0,1,0 ;1
db 1,0,0,1,1,1,0,1,0,1,0,0,0,1,1,0,1,0,0,1,1,0,0,0,0,0,0,0,1,0,1,1,0,0,1,0,1,0 ;2
db 0,0,0,1,1,1,0,1,0,1,0,0,0,1,1,0,1,0,0,1,1,0,0,0,0,0,0,0,1,0,1,1,0,0,1,0,1,0 ;3
db 0,1,0,1,1,1,0,1,0,1,0,0,0,1,1,0,1,0,0,1,1,0,0,0,0,0,0,0,1,0,1,1,0,0,1,0,1,0 ;4
db 0,0,0,1,1,1,0,1,0,1,0,0,0,1,1,0,1,0,0,1,1,0,0,0,0,0,0,0,1,0,1,1,0,0,1,0,1,0 ;5
db 0,0,0,1,1,1,0,1,0,1,0,0,0,1,1,0,1,0,0,1,1,0,0,0,0,0,0,0,1,0,1,1,0,0,1,0,1,0 ;6
db 0,0,1,1,0,0,1,1,0,1,0,1,0,0,0,1,1,0,1,0,0,1,1,0,0,0,0,0,0,0,1,0,1,1,0,0,1,0 ;7
db 0,0,0,1,1,1,0,1,0,1,0,0,0,1,1,0,1,0,0,1,1,0,0,0,0,0,0,0,1,0,1,1,0,0,1,0,1,0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3,4,5,6,7,8,9,0,1,2,30,4,5,6 ;3
db 10,2,3,4,5,6,7,8,9,0,1,20,3,4,5,6 ;4
db 10,2,3,4,5,6,7,8,9,0,10,2,3,4,5,6 ;5
db 10,2,3,4,5,6,7,8,9,00,1,2,3,4,5,6 ;6
db 10,2,3,4,5,6,7,8,90,0,1,2,3,4,5,6 ;7
db 10,2,3,4,5,6,7,80,9,0,1,2,3,4,5,6 ;8
db 10,2,3,4,5,6,70,8,9,0,1,2,3,4,5,6 ;9
db 10,2,3,4,5,60,7,8,9,0,1,2,3,4,5,6 ;0
db 10,2,3,4,50,6,7,8,9,0,1,2,3,4,5,6 ;1
db 10,2,3,40,5,6,7,8,9,0,1,2,3,4,5,6 ;2
db 10,2,30,4,5,6,7,8,9,0,1,2,3,4,5,6 ;3
db 10,20,3,4,5,6,7,8,9,0,1,2,3,4,5,6 ;4
db 10,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6 ;5
db 1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6
palette1 db 768 dup (?)
main1_pic db 'main1.pic',0
fileh dw 0
;--- The offset of the current map
mapoff dw offset map1
;--- The dimensions of the current map
mapx dw 36
mapy dw 36
maxxpos dw 23*16
minxpos dw 0
maxypos dw 12*16
minypos dw 0
;▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄Scroll1▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
;--- These all get calculated anyway.
indexX dw 0
indexY dw 0
;--- These are required as starting position
Ypos dw 100
Xpos dw 100
;--- Set these for each scroll...
movex dw 2
movey dw -2
;--- These are the pointers...
scrorigin dw 0
source dw 0
;▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄Scroll2▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
;--- These all get calculated anyway.
indexX2 dw 0
indexY2 dw 0
;--- These are required as starting position
Ypos2 dw 100
Xpos2 dw 50
;--- Set these for each scroll...
movex2 dw 1
movey2 dw 1
;--- These are the pointers...
scrorigin2 dw 0
source2 dw 0
;------- segments: ---------
background dw 0
background2 dw 0
────────────────────────────────────────────────────────────────────────────────
; The code segment...
.code
Main:
mov ah,04ah
mov bx,10000/16
int 21h
mov dx,@data
mov ds,dx
mov ah,048h
mov bx,1000h
int 21h
jc nosav
mov background,ax
mov ah,048h
mov bx,1000h
int 21h
jc nosav
mov background2,ax
mov ax,13h
int 10h
mov ax,0a000h
mov es,ax
; graphix is up, background is up
mov ax,3d00h
mov dx,offset main1_pic
int 21h
jc nosav
mov fileh,ax
mov bx,ax
mov ah,42h
xor al,al
xor cx,cx
mov dx,32
int 21h
jc nosav
mov bx,fileh
mov ah,3fh
mov cx,768
mov dx,offset palette1
int 21h
jc nosav
mov bx,fileh
mov ah,3fh
mov cx,64000
push ds
mov dx,0a000h
mov ds,dx
xor dx,dx
int 21h
jc nosav
pop ds
mov ah,3eh
int 21h
jc nosav
mov dx,3c8h
xor al,al
out dx,al
inc dx
mov cx,768
mov si,offset palette1
rep outsb
; xor di,di
call initscroll1
mov di,scrorigin
sub di,16+16*320
mov si,offset map1
push es
mov cx,background
mov es,cx
mov cx,10
ll1:
push di
push cx
mov cx,10
push si
ll2: lodsb
push di
push cx
call do16fs
pop cx
pop di
add di,16
loop ll2
pop si
add si,mapx
pop cx
pop di
add di,16*320
loop ll1
pop es
mov cx,mapx
sub cx,8
shl cx,4
mov maxxpos,cx
mov bx,Ypos
shl bx,1
mov di,rows[bx]
add di,Xpos
mov SCRorigin,di
mov bx,Xpos
and bx,15
mov indexX,bx
mov bx,Ypos
and bx,15
mov indexY,bx
mov bx, Ypos
shr bx, 4
mov ax, mapX
mul bx
mov source, ax
mov bx, Xpos
shr bx, 4
add source, bx
call init_scroll2
;
; ▄▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▄
;█ ┌─┬─┐ ┌───┐ ┐ ┌──┐ │ ┌───┐ ┌───┐ ┌───┐ █
;█ │ │ │ │ │ │ └┐ │ │ │ │ │ │ │ █
;█ │ │ ├───┤ │ │ │ │ │ │ │ │ ├───┘ █
;█ │ │ │ │ │ │ │ └─── └───┘ └───┘ │ █
; ▀▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▀
;
mainl1:
mov cx,background
mov di,16+14*320
mov si,scrorigin
call transfer_scroll ;transfer the data to the screen
mov cx,background2
mov di,176+14*320
mov si,scrorigin2
call transfer_scroll ;transfer the data to the screen
call update_scroll1
call update_scroll2
call check2
call check1
mov ah,1
int 16h
jnz nosav
call waitretrace
jmp mainl1
nosav:
mov ax,04c00h
int 21h
write_block:
writeblock:
do16fs: ; writes a 16x16 block to es:di (now 286...) from ds:si
mov cx,16
do16fs1:
push cx
mov cx,16
rep movsb
pop cx
add di,320-16
loop do16fs1
ret
transfer_scroll: ; writes a 16x16 from fs:si to es:di
transferscroll: ; cx is the segment...
; es is the destination segment
; di is the destination pointer
; si is the source pointer
push ds
mov ds,cx
mov cx,8*16
do16es1:
push cx
mov cx,8*16
rep movsb
pop cx
add si,320-128
add di,320-128
loop do16es1
pop ds
ret
include ret.inc
do_row:
; di is the position in backmem
; si is the position in map...
; cx is the segment
push es
mov es,cx
mov cx,9 ; 8 tiles across, one extra incase of x warp.
dorow1:
push cx
lodsb
push si
mov ah,al
xor al,al
mov si,ax
add si,offset blocks
push di
call do16fs
pop di
add di,16
pop si
pop cx
loop dorow1
pop es
nop
ret
do_col:
; di is the position in backmem
; si is the position in map....
; cx is the segment
push es
mov es,cx
mov cx,9
docol1:
mov ah, [si]
push si
xor al,al
mov si,ax
add si,offset blocks
push cx
push di
call do16fs
pop di
pop cx
pop si
add si, mapx
add di, 16*320
loop docol1
pop es
ret
include scroll2.inc
include scroll1.inc
END Main